<template>
	<view>
		<view class="music_search">
			<input type="text" placeholder="搜索你感兴趣的内容" confirm-type="search" placeholder-class="place" focus @input="inpSearch"/>
			<view class="sousuo" @click="handle">搜索</view>
		</view>
		<view>
			<view class="cates_title">
				<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" style-type="text"></uni-segmented-control>
			</view>
		</view>
		<view class="content" v-if="isContent">
			<view v-show="current === 0">
				<view class="user">
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
				</view>
			</view>
			<view v-show="current === 1">
				<view class="gedan">
					<view>
						<image src="../../static/gedan.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
				</view>
			</view>
			<view v-show="current === 2">
				<view class="gedan">
					<view>
						<image src="../../static/qia.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
				</view>
			</view>
			<view v-show="current === 3">
				<view class="gedan">
					<view>
						<image src="../../static/qia.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text>恰恰歌曲大合集</text>
					</view>
				</view>
			</view>
			<view v-show="current === 4">
				<view class="goods">
					<view>
						<image src="../../static/qia.png"></image>
						<text class="box01">恰恰歌曲大合集</text>
						<text class="price">￥389</text>
						
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text class="box01">恰恰歌曲大合集</text>
						<text class="price">￥389</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text class="box01">恰恰歌曲大合集</text>
						<text class="price">￥389</text>
					</view>
					<view>
						<image src="../../static/logo.png"></image>
						<text class="box01">恰恰歌曲大合集</text>
						<text class="price">￥389</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uniSegmentedControl from "@/components/uni-segmented-control/uni-segmented-control.vue"
	export default {
		components: {
			uniSegmentedControl
		},
		data () {
			return {
				value: "",
				items: ['用户','音乐','视频','课程','商品'],
				current: 0,
				isContent: false
			}
		},
		onHide () {
			this.isContent = false
		},
		methods: {
			onClickItem(e) {
				if (this.current !== e.currentIndex) {
					this.current = e.currentIndex;
				}
			},
			inpSearch (event) {
				// console.log(event)
				this.value = event.detail.value
			},
			handle () {
				if (this.value.trim().length === 0) {
					return false
				}
				console.log("ok")
				this.isContent = true
			}
		}
	}
</script>

<style lang="scss">
	.music_search {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 28rpx;
		margin: 10rpx 0;
		input {
			display: flex;
			align-items: center;
			box-sizing: border-box;
			width:604rpx;
			height:60rpx;
			background:rgba(246,247,248,1);
			border-radius:30rpx;
			padding-left: 30rpx;
			&::before {
				content: ""; // 必须要加
				display: inline-block;  // 必须加，改变其元素分类，让我们可以设置其宽高
				width:20rpx;
				height:20rpx;
				background: rgba(203,208,215,1) url(../../static/sousu.png) no-repeat;
				background-size:cover; // 背景图片的大小需要在背景图片后面添加，在前面加无效
				margin: 0 6rpx;
			}
			.place {
				width:216rpx;
				height:34rpx;
				font-size:24rpx;
				font-family:PingFangSC-Regular,PingFang SC;
				font-weight:400;
				color:rgba(166,170,177,1);
				line-height:34rpx;
			}
		}
		.sousuo {
			width:64rpx;
			height:44rpx;
			font-size:32rpx;
			font-family:PingFangSC-Regular,PingFang SC;
			font-weight:400;
			color:rgba(32,34,46,1);
			line-height:44rpx;
		}
	}
	.cates_title {
		display: flex;
		justify-content: space-around;
		align-items: center;
		position: relative;
		padding: 0 20rpx;
		border-bottom: 1rpx solid #ccc; 
		.segmented-control__item {
			padding: 0 20rpx;
			margin: 0 10rpx;
		}
	}
	.content {
		margin-top: 20rpx;
		.user {
			padding: 0 20rpx;
			view {
				display: flex;
				align-items: center;
				height: 140rpx;
				border-bottom: 1rpx solid #ccc;
				image {
					width:100rpx;
					height:100rpx;
					border-radius:8rpx;
				}
				text {
					height:44rpx;
					font-size:32rpx;
					font-family:PingFangSC-Medium,PingFang SC;
					font-weight:500;
					color:rgba(1,7,49,1);
					line-height:44rpx;
				}
			}
		}
		.gedan {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-around;
			align-items: center;
	
			view {
				display: flex;
				flex-direction: column;
				align-items: center;
	
				image {
					width: 216rpx;
					height: 216rpx;
				}
	
				text {
					width: 196rpx;
					height: 40rpx;
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: rgba(51, 51, 51, 1);
					line-height: 40rpx;
					margin: 12rpx 0 30rpx 0;
				}
			}
		}
		.goods {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-around;
			view {
				width: 342rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-around;
				margin-bottom: 20rpx;
				image {
					width:336rpx;
					height:336rpx;
				}
				.box01 {
					width:342rpx;
					font-size:30rpx;
					font-family:PingFangSC-Medium,PingFang SC;
					font-weight:500;
					color:rgba(51,51,51,1);
					line-height:1;
					margin: 6rpx 0;
				}
				.price {
					width:86rpx;
					height:50rpx;
					font-size:36rpx;
					font-family:PingFangSC-Medium,PingFang SC;
					font-weight:500;
					color:rgba(255,59,48,1);
					line-height:50rpx;
				}
			}
		}
	}
</style>
